home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / pcq12b.lzh / Include / Devices / HardBlocks.i < prev    next >
Text File  |  1990-08-27  |  9KB  |  228 lines

  1. {
  2.     HardBlocks.i for PCQ Pascal
  3.  
  4.     File System identifier blocks for hard disks
  5. }
  6.  
  7. {--------------------------------------------------------------------
  8.  *
  9.  *    This file describes blocks of data that exist on a hard disk
  10.  *    to describe that disk.  They are not generically accessable to
  11.  *    the user as they do not appear on any DOS drive.  The blocks
  12.  *    are tagged with a unique identifier, checksummed, and linked
  13.  *    together.  The root of these blocks is the RigidDiskBlock.
  14.  *
  15.  *    The RigidDiskBlock must exist on the disk within the first
  16.  *    RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  17.  *    cylinder in an AmigaDOS partition: although it is strictly
  18.  *    possible to store the RigidDiskBlock data in the reserved
  19.  *    area of a partition, this practice is discouraged since the
  20.  *    reserved blocks of a partition are overwritten by "Format",
  21.  *    "Install", "DiskCopy", etc.  The recommended disk layout,
  22.  *    then, is to use the first cylinder(s) to store all the drive
  23.  *    data specified by these blocks: i.e. partition descriptions,
  24.  *    file system load images, drive bad block maps, spare blocks,
  25.  *    etc.
  26.  *
  27.  *    Though only 512 byte blocks are currently supported by the
  28.  *    file system, this proposal tries to be forward-looking by
  29.  *    making the block size explicit, and by using only the first
  30.  *    256 bytes for all blocks but the LoadSeg data.
  31.  *
  32.  *------------------------------------------------------------------}
  33.  
  34. {
  35.  *  NOTE
  36.  *    optional block addresses below contain $ffffffff to indicate
  37.  *    a NULL address, as zero is a valid address
  38. }
  39.  
  40. type
  41.  
  42.     RigidDiskBlock = record
  43.     rdb_ID        : Integer;    { 4 character identifier }
  44.     rdb_SummedLongs    : Integer;    { size of this checksummed structure }
  45.     rdb_ChkSum    : Integer;    { block checksum (longword sum to zero) }
  46.     rdb_HostID    : Integer;    { SCSI Target ID of host }
  47.     rdb_BlockBytes    : Integer;    { size of disk blocks }
  48.     rdb_Flags    : Integer;    { see below for defines }
  49.  
  50.     { block list heads }
  51.  
  52.     rdb_BadBlockList : Integer;    { optional bad block list }
  53.     rdb_PartitionList : Integer;    { optional first partition block }
  54.     rdb_FileSysHeaderList : Integer; { optional file system header block }
  55.     rdb_DriveInit    : Integer;    { optional drive-specific init code }
  56.  
  57.                 { DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 }
  58.  
  59.     rdb_Reserved1    : Array [0..5] of Integer; { set to $ffffffff }
  60.  
  61.     { physical drive characteristics }
  62.  
  63.     rdb_Cylinders    : Integer;    { number of drive cylinders }
  64.     rdb_Sectors    : Integer;    { sectors per track }
  65.     rdb_Heads    : Integer;    { number of drive heads }
  66.     rdb_Interleave    : Integer;    { interleave }
  67.     rdb_Park    : Integer;    { landing zone cylinder }
  68.     rdb_Reserved2    : Array [0..2] of Integer;
  69.     rdb_WritePreComp : Integer;    { starting cylinder: write precompensation }
  70.     rdb_ReducedWrite : Integer;    { starting cylinder: reduced write current }
  71.     rdb_StepRate    : Integer;    { drive step rate }
  72.     rdb_Reserved3    : Array [0..4] of Integer;
  73.  
  74.     { logical drive characteristics }
  75.  
  76.     rdb_RDBBlocksLo    : Integer;    { low block of range reserved for hardblocks }
  77.     rdb_RDBBlocksHi    : Integer;    { high block of range for these hardblocks }
  78.     rdb_LoCylinder    : Integer;    { low cylinder of partitionable disk area }
  79.     rdb_HiCylinder    : Integer;    { high cylinder of partitionable data area }
  80.     rdb_CylBlocks    : Integer;    { number of blocks available per cylinder }
  81.     rdb_AutoParkSeconds : Integer;    { zero for no auto park }
  82.     rdb_Reserved4    : Array [0..1] of Integer;
  83.  
  84.     { drive identification }
  85.  
  86.     rdb_DiskVendor    : Array [0..7] of Char;
  87.     rdb_DiskProduct    : Array [0..15] of Char;
  88.     rdb_DiskRevision : Array [0..3] of Char;
  89.     rdb_ControllerVendor : Array [0..7] of Char;
  90.     rdb_ControllerProduct : Array [0..15] of Char;
  91.     rdb_ControllerRevision : Array [0..3] of Char;
  92.     rdb_Reserved5    : Array [0..9] of Integer;
  93.     end;
  94.     RigidDiskBlockPtr = ^RigidDiskBlock;
  95.  
  96. const
  97.     IDNAME_RIGIDDISK    = $5244534B;   { RDSK }
  98.  
  99.     RDB_LOCATION_LIMIT    = 16;
  100.  
  101.     RDBFB_LAST        = 0;    { no disks exist to be configured after }
  102.     RDBFF_LAST        = $01;    {   this one on this controller }
  103.     RDBFB_LASTLUN    = 1;    { no LUNs exist to be configured greater }
  104.     RDBFF_LASTLUN    = $02;    {   than this one at this SCSI Target ID }
  105.     RDBFB_LASTTID    = 2;    { no Target IDs exist to be configured }
  106.     RDBFF_LASTTID    = $04;    {   greater than this one on this SCSI bus }
  107.     RDBFB_NORESELECT    = 3;    { don't bother trying to perform reselection }
  108.     RDBFF_NORESELECT    = $08;    {   when talking to this drive }
  109.     RDBFB_DISKID    = 4;    { rdb_Disk... identification valid }
  110.     RDBFF_DISKID    = $10;
  111.     RDBFB_CTRLRID    = 5;    { rdb_Controller... identification valid }
  112.     RDBFF_CTRLRID    = $20;
  113.  
  114. {------------------------------------------------------------------}
  115.  
  116. type
  117.  
  118.     BadBlockEntry = record
  119.     bbe_BadBlock    : Integer;    { block number of bad block }
  120.     bbe_GoodBlock    : Integer;    { block number of replacement block }
  121.     end;
  122.     BadBlockEntryPtr = ^BadBlockEntry;
  123.  
  124.     BadBlockBlock = record
  125.     bbb_ID        : Integer;    { 4 character identifier }
  126.     bbb_SummedLongs    : Integer;    { size of this checksummed structure }
  127.     bbb_ChkSum    : Integer;    { block checksum (longword sum to zero) }
  128.     bbb_HostID    : Integer;    { SCSI Target ID of host }
  129.     bbb_Next    : Integer;    { block number of the next BadBlockBlock }
  130.     bbb_Reserved    : Integer;
  131.     bbb_BlockPairs    : Array [0..60] of BadBlockEntry; { bad block entry pairs }
  132.     { note [61] assumes 512 byte blocks }
  133.     end;
  134.     BadBlockBlockPtr = ^BadBlockBlock;
  135.  
  136. const
  137.  
  138.     IDNAME_BADBLOCK    = $42414442;   { BADB }
  139.  
  140. {------------------------------------------------------------------}
  141.  
  142. type
  143.  
  144.     PartitionBlock = record
  145.     pb_ID        : Integer;    { 4 character identifier }
  146.     pb_SummedLongs    : Integer;    { size of this checksummed structure }
  147.     pb_ChkSum    : Integer;    { block checksum (longword sum to zero) }
  148.     pb_HostID    : Integer;    { SCSI Target ID of host }
  149.     pb_Next        : Integer;    { block number of the next PartitionBlock }
  150.     pb_Flags    : Integer;    { see below for defines }
  151.     pb_Reserved1    : Array [0..1] of Integer;
  152.     pb_DevFlags    : Integer;    { preferred flags for OpenDevice }
  153.     pb_DriveName    : Array [0..31] of Char; { preferred DOS device name: BSTR form }
  154.                     { (not used if this name is in use) }
  155.     pb_Reserved2    : Array [0..14] of Integer; { filler to 32 longwords }
  156.     pb_Environment    : Array [0..16] of Integer; { environment vector for this partition }
  157.     pb_EReserved    : Array [0..14] of Integer; { reserved for future environment vector }
  158.     end;
  159.     PartitionBlockPtr = ^PartitionBlock;
  160.  
  161. const
  162.  
  163.     IDNAME_PARTITION    = $50415254;    { PART }
  164.  
  165.     PBFB_BOOTABLE    = 0;    { this partition is intended to be bootable }
  166.     PBFF_BOOTABLE    = 1;    {   (expected directories and files exist) }
  167.     PBFB_NOMOUNT    = 1;    { do not mount this partition (e.g. manually }
  168.     PBFF_NOMOUNT    = 2;    {   mounted, but space reserved here) }
  169.  
  170. {------------------------------------------------------------------}
  171.  
  172. type
  173.  
  174.     FileSysHeaderBlock = record
  175.     fhb_ID        : Integer;    { 4 character identifier }
  176.     fhb_SummedLongs    : Integer;    { size of this checksummed structure }
  177.     fhb_ChkSum    : Integer;    { block checksum (longword sum to zero) }
  178.     fhb_HostID    : Integer;    { SCSI Target ID of host }
  179.     fhb_Next    : Integer;    { block number of next FileSysHeaderBlock }
  180.     fhb_Flags    : Integer;    { see below for defines }
  181.     fhb_Reserved1    : Array [0..1] of Integer;
  182.     fhb_DosType    : Integer;    { file system description: match this with }
  183.                 { partition environment's DE_DOSTYPE entry }
  184.     fhb_Version    : Integer;    { release version of this code }
  185.     fhb_PatchFlags    : Integer;    { bits set for those of the following that }
  186.                 {   need to be substituted into a standard }
  187.                 {   device node for this file system: e.g. }
  188.                 {   0x180 to substitute SegList & GlobalVec }
  189.     fhb_Type    : Integer;    { device node type: zero }
  190.     fhb_Task    : Integer;    { standard dos "task" field: zero }
  191.     fhb_Lock    : Integer;    { not used for devices: zero }
  192.     fhb_Handler    : Integer;    { filename to loadseg: zero placeholder }
  193.     fhb_StackSize    : Integer;    { stacksize to use when starting task }
  194.     fhb_Priority    : Integer;    { task priority when starting task }
  195.     fhb_Startup    : Integer;    { startup msg: zero placeholder }
  196.     fhb_SegListBlocks : Integer;    { first of linked list of LoadSegBlocks: }
  197.                 {   note that this entry requires some }
  198.                 {   processing before substitution }
  199.     fhb_GlobalVec    : Integer;    { BCPL global vector when starting task }
  200.     fhb_Reserved2    : Array [0..22] of Integer; { (those reserved by PatchFlags) }
  201.     fhb_Reserved3    : Array [0..20] of Integer;
  202.     end;
  203.     FileSysHeaderBlockPtr = ^FileSysHeaderBlock;
  204.  
  205. const
  206.  
  207.     IDNAME_FILESYSHEADER    = $46534844;    { FSHD }
  208.  
  209. {------------------------------------------------------------------}
  210.  
  211. Type
  212.  
  213.     LoadSegBlock = record
  214.     lsb_ID        : Integer;    { 4 character identifier }
  215.     lsb_SummedLongs    : Integer;    { size of this checksummed structure }
  216.     lsb_ChkSum    : Integer;    { block checksum (longword sum to zero) }
  217.     lsb_HostID    : Integer;    { SCSI Target ID of host }
  218.     lsb_Next    : Integer;    { block number of the next LoadSegBlock }
  219.     lsb_LoadData    : Array [0..122] of Integer;    { data for "loadseg" }
  220.     { note [123] assumes 512 byte blocks }
  221.     end;
  222.     LoadSegBlockPtr = ^LoadSegBlock;
  223.  
  224. const
  225.  
  226.     IDNAME_LOADSEG    = $4C534547;    { LSEG }
  227.  
  228.